using System.Collections.Generic;
using System.Linq;
using UnityEditor;

public class ShapeSDFManager  
{ 
    public static ShapeSDFManager Instance = new ShapeSDFManager();
    private List<SDFShape> m_Shapes = new List<SDFShape>();
    ShapeSDFManager()
    {}

    public SDFRenderFeature.ShapeData []GetShapesData()
    {
        var shapes = m_Shapes.Select((x) => x.GetShapeData());
        return shapes.ToArray();
    }

    public void UpdateShapeData()
    {
        if (m_DataProvider != null)
        {
            var shapes = m_Shapes.Select((x) => x.GetShapeData());
            m_DataProvider.UpdateShapeData(shapes.ToArray());
        }
    }

    public void AddShape(SDFShape shape)
    {
        m_Shapes.Add(shape);
    }
    public void RemoveShape(SDFShape shape)
    {
        m_Shapes.Remove(shape);
    }
    ShapeDataProvider m_DataProvider;
    public void SetDataProvider(ShapeDataProvider provider)
    {
        m_DataProvider = provider;
    }
}